#include <54func.h>
int main(int argc,char *argv[])
{
    // ./10_open_after_fork file
    ARGS_CHECK(argc,2);
    if(fork())
    {
        sleep(2);
        int fd = open(argv[1],O_RDWR);
        ERROR_CHECK(fd,-1,"open");
        write(fd,"World!",6);
    }else
    {
        int fd = open(argv[1],O_RDWR);
        write(fd,"Hello",5);
        ERROR_CHECK(fd,-1,"open");
    }
    return 0;

    //总结：先打开文件，在fork，那么父进程与子进程不是共享同一个文件对象，后写的覆盖先写的内容
}
